function [strerr] = ord_strerr(controlvec, errstr)
%Picks irf to structural shocks and according forcast error variance
%decomposition.

%[nshocks]=size(sis,1);
%nsteps=size(irf,3);

%Compute total variance


% for shock=1:nshocks;
%     for str_shock=1:n_str_shocks;
%         
%     if sis(shock,1)==10^str_shock;
%         for var=1:nshocks
%         resp2err(var,str_shock,:)=rdc(var,shock)*errstr(shock,:);
%         %frac2err(var,str_shock,:) =squeeze(resp2err(var,str_shock,:))./(rdc(var,:)*errstr(:,:))';
%         resp2tot(var,str_shock,:) =(rdc(var,:)*errstr(:,:))';
%         strerr(var,str_shock,:)=errstr(shock,:);
%         end
%     end
%     end
% end
 
[nshocks, n_str_shocks]=size(controlvec);
%nvars=size(irf,1);
%nsteps=size(irf,3);



 nostrshock=n_str_shocks;
for shock=1:nshocks;
  if max(controlvec(shock,:))==0
      nostrshock=nostrshock+1;
       strerr(nostrshock,:)=errstr(shock,:);
  else
    for str_shock=1:n_str_shocks;
        if controlvec(shock,str_shock)==1
                 strerr(str_shock,:)=errstr(shock,:);
        end
    end
  end
end        